{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Numpy包练习\n",
    "\n",
    "## 创建ndarray\n",
    "\n",
    "### 通过array函数创建ndarray对象\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "numpy.ndarray"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "data0 = [2, 4, 6.5, 8]\n",
    "arr0 = np.array(data0)\n",
    "type(arr0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 2, 3, 4],\n",
       "       [5, 6, 7, 8]])"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 创建多维数组\n",
    "data1 = [[1, 2, 3, 4], [5, 6, 7, 8]]\n",
    "arr1 = np.array(data1)\n",
    "arr1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 指定类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1., 2., 3., 4.],\n",
       "       [5., 6., 7., 8.]], dtype=float32)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 利用dtype关键字，传入合适的数据类型，显式地定义\n",
    "arr2 = np.array(data1, dtype=np.float32)\n",
    "arr2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2, 4)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr2.dtype\n",
    "arr2.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 定义bool类型的数组"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ True, False],\n",
       "       [False,  True]])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 通过整形1和0，定义布尔类型的数组\n",
    "data2 = [[1, 0], [0, 1]]\n",
    "arr3 = np.array(data2, dtype=bool)\n",
    "arr3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1.23, 2.67],\n",
       "       [1.45, 6.  ]], dtype=float32)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data6 =[[1.230, 2.670], [1.450, 6.000]]\n",
    "arr6 = np.array(data6, np.float32)\n",
    "arr6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1.23, 2.67],\n",
       "       [1.45, 6.  ]], dtype=float16)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr6.astype(np.float16)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1.23, 2.67],\n",
       "       [1.45, 6.  ]], dtype=float32)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr6.astype(np.int8)\n",
    "arr6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[3.1416 9.8888]\n"
     ]
    }
   ],
   "source": [
    "# precision: 默认保留8位位有效数字，后面不会补0；supress: 对很大/小的数不使用科学计数法 (True)\n",
    "np.set_printoptions(precision=4, suppress=True)\n",
    "# 对浮点数数组，保留4位有效数字，并禁用科学计数法；小数位数不够，后面不会补0\n",
    "arr7 = np.array([3.141592653,9.8888])  # 定义一个2维数组\n",
    "print(arr7)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 2 3 4 5 6 7 8 9]\n"
     ]
    }
   ],
   "source": [
    "arr_uniform0 = np.arange(1,10,1)\n",
    "print(arr_uniform0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr_rand0 = np.random.rand(3, 2)\n",
    "arr_rand1 = np.random.rand(1, 10)\n",
    "arr_rand2 = np.random.uniform(1, 44, (1, 10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr_rand3 = arr_rand2.astype(np.int16)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Matplotlib is building the font cache; this may take a moment.\n"
     ]
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "# 生成10万个身高数据\n",
    "arr_height = np.random.normal(175, 10, size=100000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 进行第一次采样，采样的样本赋值给sample_height，存储格式为ndarray\n",
    "sample_height = np.random.choice(arr_height, size=1, replace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [],
   "source": [
    "# average 用来存储每次采样后计算的平均身高\n",
    "average = []\n",
    "# 进行10000轮循环采样，因为每次仅采集1个样本，所以整个过程可以视为有放回抽样\n",
    "n = 10000"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "for round in range(n):\n",
    "    sample = np.random.choice(arr_height, size=1, replace=True)\n",
    "    sample_height = np.append(sample_height, sample)\n",
    "    average.append(np.average(sample_height))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAfQAAAFzCAYAAADIY/vqAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAr/klEQVR4nO3debxdVX3//9cn80BIAgkQCBDmyqAoEbFqK0jBOvGtAxLaKmrlq9UqfqsodUIttSp1KopiRcQKQnGstiL4U1AEJECQKQwyBiKZyDwQks/vj7Wv99wp99wk5557d17Px+M+zj5rn2Gdffc5773WXnvvyEwkSdLwNqLdFZAkSdvOQJckqQYMdEmSasBAlySpBgx0SZJqwECXJKkGRrW7Atti2rRpOWvWrHZXQ5KkQXPzzTcvyczp3ctbFugRcSHwCmBRZh5elV0GHFI9ZAqwPDOPjIjRwH8Az6nqdHFmfrK/95g1axZz585tRfUlSRqSIuLh3spb2UK/CDgPuLijIDNf31ChfwNWVHdfB4zNzCMiYgJwV0RcmpkPtbB+kiTVRssCPTOvjYhZvc2LiABOBo7reDgwMSJGAeOBp4CVraqbJEl1065BcS8CnsjM+6r7VwBrgIXAI8C5mbmstydGxOkRMTci5i5evHhwaitJ0hDXrkCfA1zacP9oYBOwJ7Af8I8RsX9vT8zMCzJzdmbOnj69x5gASZJ2SIM+yr3qVn81cFRD8anATzNzI7AoIq4DZgMPDHb9JEkajtrRQj8emJ+ZCxrKHqHanx4RE4FjgPltqJskScNSywI9Ii4FrgcOiYgFEfGWatYpdO1uB/gSsFNE3AncBHwjM3/XqrpJklQ3rRzlPqeP8tN6KVtNOXRNkiRtBU/9KklSDRjokiTVgIEuSVINGOjdLFzY7hpIkjRwBnqDefPg7LPh5pvbXRNJkgbGQG/w2GPldsGCLT9OkqShxkBvE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Htrouk7cMud0mSasAWuiRJNWALXZKkGjDQJUmqAQNdkqQaMNAlSaoBA12SpBow0CVJqoH/H2lasHK+GJRWAAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 576x432 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 进行绘图，具体过程在第四章详细说明\n",
    "plt.figure(figsize=(8,6))\n",
    "plt.plot(np.arange(n), average, alpha=0.6, color='blue')\n",
    "plt.plot(np.arange(n), [175 for i in range(n)], alpha=0.6, color='red', linestyle='--')\n",
    "plt.xlabel(\"Sample Rounds\", fontsize=10)\n",
    "plt.ylabel(\"Average Height\", fontsize=10)\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "11f1dc213e07634baa4c5c321dec03c05dafae643c50f20e6d1a492290c05dc2"
  },
  "kernelspec": {
   "display_name": "Python 3.9.7 64-bit",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
